<template>
  <div class="menu">
    <el-aside width="200px">
      <!-- <el-col :span="12"> -->
      <el-menu
        router
        default-active="2"
        class="el-menu-vertical-demo"
        background-color="#2578B5"
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <template v-for="(item, index) in listrouter">
          <el-submenu :index="index + ''" :key="index" v-if="!item.hideden">
            <template slot="title">
              <i :class="item.iconclass"></i>
              <span>{{ item.name }}</span>
            </template>
            <el-menu-item-group
              v-for="(itemx, index) in item.children"
              :key="index"
            >
              <el-menu-item :index="itemx.path">
                <i :class="itemx.iconclass"></i>
                {{ itemx.name }}</el-menu-item
              >
            </el-menu-item-group>
          </el-submenu>
        </template>
      </el-menu>
      <!-- </el-col> -->
    </el-aside>
  </div>
</template>
<script>
export default {
  data() {
    return {
      listrouter: [],
    };
  },
  created() {
    //   this.listrouter = this.$router.options.routes[0].children
    this.listrouter = this.$router.options.routes;
    console.log(this.$router.options.routes);
    console.log(this.$router.options.routes[0]);
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>
<style lang="scss" scoped>
.menu {
  .el-aside {
    height: 100%;
    .el-menu {
      height: 100%;
    }
    .el-submenu .el-menu-item {
      min-width: 0;
    }
  }
}
</style>
